package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.maintenancesystem.task;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.maintenancesystem.task.DataAnalysisService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * 统计分析数据控制器
 */
@Action
@RequestMapping(value = "dataAnalysis")
public class DataAnalysisController extends BaseController {

    @Resource
    private DataAnalysisService dataAnalysisService;

    /**
     * 大屏所需要的数据
     * @param jsonParam
     * @return
     */
    @At(value = "getBigScreenData", method = RequestMethod.GET)
    public RespEntity getBigScreenData(@RequestBody(required = false) JSONObject jsonParam) {
        return dataAnalysisService.getBigScreenData(jsonParam);
    }

    /**
     * 报告导出
     * @param jsonParam
     * @return
     * @throws Exception
     */
    @At(value = "getReport", method = RequestMethod.GET)
    public RespEntity getReport(@RequestBody(required = false) JSONObject jsonParam ) throws Exception {
        return dataAnalysisService.getReport(jsonParam);
    }
//    @At(value = "getReport", method = RequestMethod.GET)
//    public ResponseEntity<byte[]> getReport(@RequestBody(required = false) JSONObject jsonParam ) throws Exception {
//        return dataAnalysisService.getReport(jsonParam);
//    }
}
